package abaco;

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Point;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

class RootSymbol extends JPanel {
	 
	public Dimension getPreferredSize() {
	return new Dimension(60, 72);
	}
	 
	protected void paintComponent(Graphics g) {
		g.setColor( Color.BLACK );
		g.drawLine(10,40,0,40);
		g.drawLine(10,40,20,70);
		g.drawLine(20,70,40,0);
		g.drawLine(40,0,130,0);
	}
}

public class Teste extends JFrame {
	private JPanel frame;
	private JPanel panel;
	 
	 
	public Teste() {
	super();
	initializeComponent();
	this.setVisible(true);
	}
	 
	private void initializeComponent() {
	frame = (JPanel)this.getContentPane();
	panel = new JPanel();
	 
	frame.setLayout(null);
	frame.setBackground(new Color(0, 0, 0));
	frame.setForeground(new Color(255, 0, 0));
	 
	addComponent(frame, panel, 350,250,60,72);
	panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
	panel.setBackground(new Color(255, 255, 255));
	panel.add( new RootSymbol() );
	 
	this.setTitle("Graph");
	this.setLocation(new Point(10, 10));
	this.setSize(new Dimension(770, 705));
	this.setResizable(false);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	 
	private void addComponent(Container container,Component c,int x,int y,int width,int height) {
	c.setBounds(x,y,width,height);
	container.add(c);
	}
	 
	 
	 
	public static void main(String[] args) {
	JFrame.setDefaultLookAndFeelDecorated(true);
	JDialog.setDefaultLookAndFeelDecorated(true);
	try {
	UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
	} catch (Exception ex) { }
	new Teste();
	}
	 
}